{include file="common/header"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">{:lang('wechat')}{:lang('list')}</div>
                <div class="layui-card-body">
                    <div class="layui-row">
                        <table class="layui-table" id="list" lay-filter="list"></table>
                    </div>
                </div>
            

            </div>
        </div>
    </div>
</div>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-group">
        <a href="javascript:;" class="layui-btn layui-btn-sm" onclick="open_frame('{:lang('add')}{:lang('wechat')}','{:url("add")}');"><i class="layui-icon layui-icon-add-circle"></i>{:lang('add')}{:lang('wechat')}</a>
        <a data-href="{:url('del')}"  class="layui-btn layui-btn-sm layui-btn-danger" id="delAll">{:lang('delete checked')}</a>
    </div>
    
</script>


<script type="text/html" id="action">
<div class="layui-btn-group">
    <a class="layui-btn  layui-btn-xs" onclick="open_frame('{:lang('edit')}{:lang('user')}','{:url("edit")}?id={{d.id}}');">{:lang('edit')}</a>
    <a data-href="{:url('del')}?id={{d.id}}" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">{:lang('del')}</a>
</div>
</script>

<script type="text/html" id="status">
    <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="status" {{ d.status == 1 ? 'checked' : '' }}>
</script>

<script type="text/html" id="avatar">
    <img src="/static/admin/images/image.gif" onmouseover="layer.tips('<img src={{d.avatar}}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();">
</script>
<script type="text/html" id="create_time">
    {{layui.util.toDateString(d.createtime*1000, 'yyyy-MM-dd HH:mm:ss')}}
</script>
<script type="text/html" id="update_time">
    {{layui.util.toDateString(d.updatetime*1000, 'yyyy-MM-dd HH:mm:ss')}}
</script>

{include file="common/footer"/}
<script>
var table;
var searchObj = {};
layui.use(['table'], function () {
    var $ = layui.jquery,
        table = layui.table;

    table.render({
        elem: '#list',
        url: '{:url("config")}',
        method: 'post',
        title: '微信',
        toolbar: '#toolbarDemo', 
        defaultToolbar: [],
        id:'tableReload',
        cols: [[
            {checkbox: true, fixed: true},
            {field: 'id', title: 'ID', width: 80, fixed: true, sort: true},
            {field: 'name', title: '公众号', width: 120,},
            {field: 'appid', title: 'AppID', width: 120, },
            {field: 'appsecret', title: 'AppSecret', width: 120, },
            {field: 'token', title: 'Token', width: 120},
            {field: 'status', title: '状态', width: 180, templet:'#status'},
            {field: 'createtime', title: '创建时间', width: 180,templet:'#create_time'},
            {field: 'updatetime', title: '更新时间', width: 180,templet:'#update_time'},

            {title:'操作',width:150, toolbar: '#action',align:"center"},

        ]],
        limits: [10, 15, 20, 25, 50, 100],
        limit: 15,
        page: true
    });
    // 搜索
    $('#searchBtn').click(function(){
        searchObj['keys'] = $('#keys').val();
        table.reload('tableReload',{where:searchObj});
    }) 
});


</script>